package servicesImp.specific;


import base.response.OffsetLimitPage;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import services.specific.CheckNotEnoughServices;
import wt.dao.specific.CheckNotEnoughMapper;
import wt.entity.specific.CheckNotEnough;

import java.util.List;


/**
 * Created by Administrator on 2017/9/13.
 */
@Service
public class CheckNotEnoughServicesImp implements CheckNotEnoughServices {

    @Autowired
    CheckNotEnoughMapper checkNotEnoughMapper;

    public List<CheckNotEnough> select(Integer times, String itemId, Integer years) throws Exception {
        return checkNotEnoughMapper.select(times, itemId, years);
    }

    public OffsetLimitPage select(Integer times, String itemId, Integer years, Integer offset, Integer limit) throws Exception {

        PageHelper.offsetPage(offset, limit);
        List<CheckNotEnough> checkNotEnoughList = checkNotEnoughMapper.select(times, itemId, years);
        return new OffsetLimitPage((Page) checkNotEnoughList);
    }
}
